<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>then 方法 then</title>
</head>
<body>
    <script>
        //实例化
        let p = new Promise((resolve, reject) => {
            //修改 promise 状态
            // resolve('OK'); //设置 p 状态为成功, 结果值为 OK
            reject('Error'); //设置 p 状态为失败, 结果值为 Error
        });

        //then 属于 promise 实例对象的. 作用: 指定 promise 实例对象成功与失败的回调
        p.then(v => {
            console.log(v);
        }, r => {
            console.log(r);
        })
    </script>
</body>
</html>